package com.docMan.bean;

import java.io.File;
import java.io.IOException;

import com.docMan.lucene.Indexer;
import com.docMan.utils.DeleteFileService;
import com.docMan.utils.FinalConfig;

public class DeleteIndexRunnable implements Runnable {
	private IndexFile indexFile;
	private Indexer indexer;

	public DeleteIndexRunnable(IndexFile indexFile) {
		this.indexFile = indexFile;
	}

	@Override
	public void run() {
		try {
			indexer = Indexer.getInstance(FinalConfig.index_dir);
			indexer.delete(indexFile.getFileId());
			indexer.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}  finally {
			try {
				indexer.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}

}
